$OpenBSD: patch-config_h,v 1.9 2016/11/22 17:20:25 dcoppa Exp $
--- config.h.orig	Tue Nov 22 12:10:09 2016
+++ config.h	Tue Nov 22 12:42:04 2016
@@ -47,7 +47,7 @@
 // If the user did not make a choice, then select CryptoNG if either
 // Visual Studio 2015 is available, or Windows 10 or above is available.
 #if !defined(USE_MS_CRYPTOAPI) && !defined(USE_MS_CNGAPI)
-# if (_MSC_VER >= 1900) || ((WINVER >= 0x0A00 /*_WIN32_WINNT_WIN10*/) || (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/))
+# if (defined(_MSC_VER) && (_MSC_VER >= 1900)) || ((defined(WINVER) && (WINVER >= 0x0A00)) || (defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0A00)))
 #  define USE_MS_CNGAPI
 # else
 #  define USE_MS_CRYPTOAPI
@@ -152,16 +152,16 @@
 #endif
 
 // __attribute__(init_priority(250)) is supported
-#if (__GNUC__ && (CRYPTOPP_INIT_PRIORITY > 0) && ((CRYPTOPP_GCC_VERSION >= 40300) || (CRYPTOPP_LLVM_CLANG_VERSION >= 20900) || (_INTEL_COMPILER >= 300)) && !(MACPORTS_GCC_COMPILER > 0) && !defined(__sun__))
+#if (__GNUC__ && (CRYPTOPP_INIT_PRIORITY > 0) && ((defined(CRYPTOPP_GCC_VERSION) && (CRYPTOPP_GCC_VERSION >= 40300)) || (defined(CRYPTOPP_LLVM_CLANG_VERSION) && (CRYPTOPP_LLVM_CLANG_VERSION >= 20900)) || (defined(_INTEL_COMPILER) && (_INTEL_COMPILER >= 300))) && !(MACPORTS_GCC_COMPILER > 0) && !defined(__sun__))
 # define HAVE_GCC_CONSTRUCTOR1 1
 #endif
 
 // __attribute__(init_priority()) is supported
-#if (__GNUC__ && (CRYPTOPP_INIT_PRIORITY > 0) && !HAVE_GCC_CONSTRUCTOR1 && !(MACPORTS_GCC_COMPILER > 0) && !defined(__sun__))
+#if (__GNUC__ && (CRYPTOPP_INIT_PRIORITY > 0) && !defined(HAVE_GCC_CONSTRUCTOR1) && (defined(MACPORTS_GCC_COMPILER) && !(MACPORTS_GCC_COMPILER > 0)) && !defined(__sun__))
 # define HAVE_GCC_CONSTRUCTOR0 1
 #endif
 
-#if (_MSC_VER && (CRYPTOPP_INIT_PRIORITY > 0))
+#if (defined(_MSC_VER) && (CRYPTOPP_INIT_PRIORITY > 0))
 # define HAVE_MSC_INIT_PRIORITY 1
 #endif
 
@@ -273,7 +273,7 @@ const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
 #endif
 
 // Need GCC 4.6/Clang 1.7/Apple Clang 2.0 or above due to "GCC diagnostic {push|pop}"
-#if (CRYPTOPP_GCC_VERSION >= 40600) || (CRYPTOPP_LLVM_CLANG_VERSION >= 10700) || (CRYPTOPP_APPLE_CLANG_VERSION >= 20000)
+#if (CRYPTOPP_GCC_VERSION >= 40600) || (defined(CRYPTOPP_LLVM_CLANG_VERSION) && (CRYPTOPP_LLVM_CLANG_VERSION >= 10700)) || (defined(CRYPTOPP_APPLE_CLANG_VERSION) && (CRYPTOPP_APPLE_CLANG_VERSION >= 20000))
 	#define CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 1
 #endif
 
@@ -364,7 +364,7 @@ NAMESPACE_END
 #endif
 
 // The section attribute attempts to initialize CPU flags to avoid Valgrind findings above -O1
-#if ((__MACH__ >= 1) && ((CRYPTOPP_LLVM_CLANG_VERSION >= 30600) || (CRYPTOPP_APPLE_CLANG_VERSION >= 70100) || (CRYPTOPP_GCC_VERSION >= 40300)))
+#if ((defined(__MACH__) && (__MACH__ >= 1)) && ((CRYPTOPP_LLVM_CLANG_VERSION >= 30600) || (CRYPTOPP_APPLE_CLANG_VERSION >= 70100) || (CRYPTOPP_GCC_VERSION >= 40300)))
 	#define CRYPTOPP_SECTION_INIT __attribute__((section ("__DATA,__data")))
 #elif ((__ELF__ >= 1) && (CRYPTOPP_GCC_VERSION >= 40300))
 	#define CRYPTOPP_SECTION_INIT __attribute__((section ("nocommon")))
@@ -423,7 +423,7 @@ NAMESPACE_END
 #endif
 
 // [GCC Bug 53431] "C++ preprocessor ignores #pragma GCC diagnostic". Clang honors it.
-#if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
+#if defined(CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE)
 # pragma GCC diagnostic ignored "-Wunknown-pragmas"
 # pragma GCC diagnostic ignored "-Wunused-function"
 #endif
@@ -465,7 +465,7 @@ NAMESPACE_END
 		#define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0
 	#endif
 
-	#if !defined(CRYPTOPP_DISABLE_SSE3) && (_MSC_VER >= 1500 || (defined(__SSE3__) && defined(__SSSE3__)))
+	#if !defined(CRYPTOPP_DISABLE_SSE3) && ((defined(_MSC_VER) && (_MSC_VER >= 1500)) || (defined(__SSE3__) && defined(__SSSE3__)))
 		#define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 1
 	#else
 		#define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0
@@ -489,21 +489,21 @@ NAMESPACE_END
 // Intrinsics availible in GCC 4.3 (http://gcc.gnu.org/gcc-4.3/changes.html) and
 //   MSVC 2008 (http://msdn.microsoft.com/en-us/library/bb892950%28v=vs.90%29.aspx)
 //   SunCC could generate SSE4 at 12.1, but the intrinsics are missing until 12.4.
-#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSE4) && !defined(_M_ARM) && ((_MSC_VER >= 1500) || (defined(__SSE4_1__) && defined(__SSE4_2__)))
+#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSE4) && !defined(_M_ARM) && ((defined(_MSC_VER) && (_MSC_VER >= 1500)) || (defined(__SSE4_1__) && defined(__SSE4_2__)))
 	#define CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE 1
 #else
 	#define CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE 0
 #endif
 
 // Don't disgorge AES-NI from CLMUL. There will be two to four subtle breaks
-#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_AESNI) && !defined(_M_ARM) && (_MSC_FULL_VER >= 150030729 || __INTEL_COMPILER >= 1110 || (defined(__AES__) && defined(__PCLMUL__)))
+#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_AESNI) && !defined(_M_ARM) && ((defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 150030729)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1110)) || (defined(__AES__) && defined(__PCLMUL__)))
 	#define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 1
 #else
 	#define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 0
 #endif
 
 // AVX2 in MSC 18.00
-#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_AVX) && !defined(_M_ARM) && ((_MSC_VER >= 1600) || (defined(__RDRND__) || defined(__RDSEED__) || defined(__AVX__)))
+#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_AVX) && !defined(_M_ARM) && ((defined(_MSC_VER) && (_MSC_VER >= 1600)) || (defined(__RDRND__) || defined(__RDSEED__) || defined(__AVX__)))
 	#define CRYPTOPP_BOOL_AVX_AVAILABLE 1
 #else
 	#define CRYPTOPP_BOOL_AVX_AVAILABLE 0
@@ -579,7 +579,7 @@ NAMESPACE_END
 // Linux provides X32, which is 32-bit integers, longs and pointers on x86_64 using the full x86_64 register set.
 // Detect via __ILP32__ (http://wiki.debian.org/X32Port). However, __ILP32__ shows up in more places than
 // the System V ABI specs calls out, like on just about any 32-bit system with Clang.
-#if ((__ILP32__ >= 1) || (_ILP32 >= 1)) && defined(__x86_64__)
+#if ((defined(__ILP32__) && (__ILP32__ >= 1)) || (defined(_ILP32) && (_ILP32 >= 1))) && defined(__x86_64__)
 	#define CRYPTOPP_BOOL_X32 1
 #else
 	#define CRYPTOPP_BOOL_X32 0
@@ -776,7 +776,7 @@ NAMESPACE_END
 
 // ************** Deprecated ***************
 
-#if (CRYPTOPP_GCC_VERSION >= 40500) || (CRYPTOPP_LLVM_CLANG_VERSION >= 20800)
+#if (CRYPTOPP_GCC_VERSION >= 40500) || (defined(CRYPTOPP_LLVM_CLANG_VERSION) && (CRYPTOPP_LLVM_CLANG_VERSION >= 20800))
 # define CRYPTOPP_DEPRECATED(msg) __attribute__((deprecated (msg)));
 #elif (CRYPTOPP_GCC_VERSION)
 # define CRYPTOPP_DEPRECATED(msg) __attribute__((deprecated));
@@ -790,7 +790,7 @@ NAMESPACE_END
 // Intel and C++11 language features, http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler
 // GCC and C++11 language features, http://gcc.gnu.org/projects/cxx0x.html
 // Clang and C++11 language features, http://clang.llvm.org/cxx_status.html
-#if ((_MSC_VER >= 1600) || (__cplusplus >= 201103L)) && !defined(_STLPORT_VERSION)
+#if ((defined(_MSC_VER) && (_MSC_VER >= 1600)) || (__cplusplus >= 201103L)) && !defined(_STLPORT_VERSION)
 # define CRYPTOPP_CXX11 1
 #endif
 
